#pragma once 
#include <Arduino.h>
class Modbus_RTU
{
public:
    enum _BaudRate {
        BaudRate_1200 = 1200,  //波特率-写入用
        BaudRate_2400 = 2400,
        BaudRate_4800 = 4800,
        BaudRate_9600 = 9600,
        BaudRate_19200 = 19200,
        BaudRate_38400 = 38400,
        BaudRate_57600 = 57600,
        BaudRate_115200 = 115200
    };
    void initTrans(Modbus_RTU::_BaudRate baudRate = (Modbus_RTU::_BaudRate) 9600);
    uint16_t CRC16_MudBus(uint8_t *puchMsg, uint8_t usDataLen);
    void SendData(unsigned char * pdata, int num);
    bool RecvData(unsigned char * poutData, int num);
};
